/-boot
/-docs
/-editor
/-files
/-files-old
/-imports
/-layout
/-shell
/-storage ...
/-storage/attached ...
/-storage/attached/api
/-storage/attached/dom
/-storage/attached/indexedDB ...
DetectStorage.ts
FileData.ts
LoadStorage.ts
MetadataData.ts
StorageAccess.ts
StorageDetect.ts
UpdateStorage.ts
functions.ts
/-storage/attached/localStorage
/-storage/attached/webSQL
/-tests
/-tests/files
/-tests/storage
/-tests/storage/attached
AttachedStorageTests.ts
AttachedStorageTestsNew.ts
DomStorageTests.ts
IndexedDBStorageTests.ts
LocalStorageStorageTests.ts
WebSQLStorageTests.ts
TestCase.html
TestCase.ts
TestPage.css
TestPage.html
TestPage.ts
_sampleTests.ts
teapo-tests.html
teapo-tests.ts
/-typings
Dom.ts
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.ts
try.html
try.js
xxxxxxxxxx
28
​
29
        outstandingRequests--;
30
        callback(null);
31
      }
32
​
33
      for (var fullPath in byFullPath) if (byFullPath.hasOwnProperty(fullPath)) {
34
​
35
        var pbag = byFullPath[fullPath];
36
​
37
        if (!pbag) {
38
          var deleteRequest = filesStore['delete'](fullPath);
39
          outstandingRequests++;
40
​
41
          deleteRequest.onerror = (errorEvent) => oneError(errorEvent, 'update: objectStore(files).delete(' + fullPath+')');
42
          deleteRequest.onsuccess = (event) => {
43
            oneCompleted();
44
          };
45
        }
46
        else {
47
          var getRequest = filesStore.get(fullPath);
48
          outstandingRequests++;
49
​
50
          getRequest.onerror = (errorEvent) => oneError(errorEvent, 'update: objectStore(files).delete(' + fullPath + ')');
51
          getRequest.onsuccess = (event) => {
52
​
53
            var fileData: FileData = getRequest.result || { path: fullPath, properties: {} };
54
​
55
            var properties = fileData.properties || (fileData.properties = {});
56
            for (var p in pbag) if (pbag.hasOwnProperty(p)) {
57
              var v = pbag[p];
58
              if (v === null || typeof v === 'undefined')
59
                delete properties[p];
60
              else
61
                properties[p] = v;
62
            }
63
​
64
            var putFile = filesStore.put(fileData);
65
            getRequest.onerror = (errorEvent) => oneError(errorEvent, 'update: objectStore(files).put(' + fullPath + ')');
66
            putFile.onsuccess = (event) =>
67
              this._updateEditedUTC(
68
                timestamp,
69
                transaction,
70
                (errorEvent) => {
71
                  if (errorEvent)
72
                    oneError(errorEvent, 'update: _updateEditedUTC');
73
                  else
74
                    oneCompleted();
75
                });
76
          };
77
        }
78
        
79
      }
80
​
81
      oneCompleted();
82
    }
83
​
84
    read(
85
      fullPath: string,
86
      callback: (error: Error, properties: { [property: string]: string; }) => void): void {
87
​
88
      var transaction = this._db.transaction('files');
89
      transaction.onerror = (errorEvent) => callback(wrapErrorEvent(errorEvent, 'read: transaction'), null);
90
      var filesStore = transaction.objectStore('files');
91
      var getRequest = filesStore.get(fullPath);
92
      getRequest.onerror = (errorEvent) => callback(wrapErrorEvent(errorEvent, 'read: get(' + fullPath +')'), null);
93
      getRequest.onsuccess = (event) => {
94
​
95
        var fileData: FileData = getRequest.result;
96
​
97
        if (!fileData)
98
          callback(new Error('File not found: ' + fullPath + '.'), null);
99
        else
100
          callback(null, fileData.properties);        
101
        
102
      };
103
    }
104
​
105
    private _updateEditedUTC(now: number, transaction: IDBTransaction, callback: (errorEvent: ErrorEvent) => void) {
106
      var metadataStore = transaction.objectStore('metadata');
107
​
108
      var metadataData = { property: 'editedUTC', value: now };
80:12 local function (): void